WEBVTT

00:01.850 --> 00:07.110
Hello everybody and welcome back to our first lesson about the none pay packets.

00:07.170 --> 00:12.980
Soon the last lessons we have seen that Python has limitations when it comes to large scale numerical

00:12.980 --> 00:19.710
operations python is simply too slow for this and therefore name the that package was created.

00:19.730 --> 00:28.130
And the roots go back to the year 1995 where it was developed under the name The MARICH And later in

00:28.130 --> 00:34.480
the year 2006 it was finally released as an unpaid package.

00:34.520 --> 00:35.930
Since then umpires.

00:35.960 --> 00:44.130
The first choice in Python when it comes to a numerical computations and fast vector US operations overlaps

00:44.240 --> 00:44.700
arrays.

00:44.720 --> 00:48.260
And we will see in the next lessons what exactly mean with this.

00:48.560 --> 00:56.150
However to give you an intuition typically so in many tasks that we use the NUM pay packets there is

00:56.180 --> 01:01.280
no further need for for loops or if and Elif and Ed statements.

01:01.280 --> 01:07.250
So with NUM PI we can reduce many lines of code and all of that can also increase the performance of

01:07.250 --> 01:13.760
our code and also umpires typically the number one choice for mathematical functions in general and

01:13.760 --> 01:18.930
in particular for linear algebra and also for a random number generation.

01:19.430 --> 01:19.790
All right.

01:19.790 --> 01:26.270
So let's stop coding and before we can use non PI we have to impart an umpire with the keyboard import

01:26.300 --> 01:29.480
num pi and then we say please use num pi.

01:29.510 --> 01:33.750
As with the previous Asian MP so that's by convention.

01:33.800 --> 01:37.590
So most of the users use the convention or the appreciation.

01:37.590 --> 01:42.180
MP fine umpire and then we create a list.

01:42.180 --> 01:51.750
So we already know lists a list from one to 10 including here at us and then we can transform the list

01:51.780 --> 01:59.670
into an so-called umpire Ray umpire race also India race fast and flexible container of large numerical

01:59.670 --> 02:06.480
data sets and these arrays enable us to perform operations on whole blocks of data and in a victorious

02:06.480 --> 02:07.110
fashion.

02:07.200 --> 02:10.350
So we will see later what I exactly mean with this.

02:10.500 --> 02:16.210
But first of all let's transform the listen to an umpire ravers the function p dot array.

02:18.000 --> 02:22.010
So now you can see that look similar to our lists here actually.

02:22.050 --> 02:27.100
And here with the array red you can see that here it's an umpire Ray.

02:27.330 --> 02:32.850
Earlier we learned that typically and to put a notebook and there's no need to use and the print function.

02:33.000 --> 02:40.530
So we can print the array by just executing the cell and it gives the same information then with the

02:40.530 --> 02:41.380
print function.

02:41.580 --> 02:46.530
However the way how the output is represented are formatted sometimes different and here.

02:46.530 --> 02:47.880
This is the case.

02:47.880 --> 02:51.030
So if we explicitly use the print function

02:55.760 --> 03:01.520
then we can see that the output is formatted in a different way and here the array looks like a vector.

03:01.530 --> 03:08.150
And yeah this is exactly how an num high array behaves later with operations.

03:08.190 --> 03:15.510
So like a mathematical back to also if you multiply a vector with a scalar let's say to then element

03:15.510 --> 03:18.740
twice each element will be multiplied by two.

03:18.810 --> 03:23.400
And that was exactly the behaviour that we didn't see the lists with lists.

03:23.460 --> 03:31.020
If we multiply a list by to be just get two times the copy of the list concatenated but we will go more

03:31.020 --> 03:33.240
into detail later in the next session.

03:33.630 --> 03:39.810
So now let's first check the data type of my array and it's num pie in the array.

03:40.200 --> 03:41.880
So umpire Ray or India right.

03:41.910 --> 03:48.330
I mean the same with it and same as lists the umpire Ray is a contain of elements so we can also iterate

03:48.390 --> 03:49.770
over an umpire Ray.

03:50.430 --> 03:57.980
So for element in my array I can print all elements 1 2 10 and 12.

03:57.990 --> 04:03.150
We have learned that lists can store many different elements so and for many different data types so

04:03.150 --> 04:13.510
our lists can star and enter into to float string and a boolean object so if we iterate over the elements

04:13.510 --> 04:20.590
of this list and print out the type of each element so we can see that erm began an integer and float

04:20.590 --> 04:22.250
and string and boolean object.

04:22.360 --> 04:29.470
So once an integer 2.5 is a float object dog is a string object and true is a boolean object.

04:29.470 --> 04:34.510
So now we are coming to the first and they are one of the most important differences between an umpire

04:34.510 --> 04:35.750
and the list.

04:35.770 --> 04:44.500
So let's try to transform the list here into an umpire Ray called a and then let's try to iterate over

04:44.500 --> 04:51.400
the elements and print out the type of each element and we can see each element as a string so we can

04:51.400 --> 04:58.630
see here also one is transformed into a string 2.5 is now a string and also true as the string and a

04:58.630 --> 05:01.060
string is typically the least common denominator.

05:01.060 --> 05:05.230
So yeah we can transform an into John a float into a string.

05:05.230 --> 05:11.440
You can also transform a boolean object into a string but you cannot transform a string into any of

05:11.600 --> 05:13.060
the other data types.

05:13.090 --> 05:16.500
So the thing is typically the lowest common denominator.

05:16.550 --> 05:17.720
Yeah and yeah.

05:17.760 --> 05:20.010
That's a general rule it out in an umpire Ray.

05:20.010 --> 05:26.560
You can only store one data type and typically and that's why if an umpire famous and successful listen

05:26.650 --> 05:31.840
that they are you typically use it with numerically the data sort with integers and floats.

05:32.240 --> 05:37.120
And that's one of the reasons why an umpire race are much faster when it comes to numerical operations

05:37.150 --> 05:41.840
because none by a dozen tests to check which data types it contains that knows.

05:41.840 --> 05:47.770
OK I only have integers off loads and I do not have to care about what data types I have.

05:47.770 --> 05:53.200
And yeah that makes it more powerful and more faster and then the numerical operations.

05:53.250 --> 05:53.700
All right.

05:53.710 --> 06:03.330
To give you a better intuition let's create an umpire Ray B with three integers so the type of still

06:03.330 --> 06:07.130
an umpire Ray and this the attribute detail.

06:07.140 --> 06:11.200
We can check the single data type that B contains.

06:11.220 --> 06:13.630
So here it's an integer.

06:13.720 --> 06:22.270
And now when we transform one element here into and float object by just adding a dot so he can see

06:22.270 --> 06:29.430
that num pi transforms all elements into a float object and let's check it here.

06:29.660 --> 06:32.990
The data type of the umpire AP is a float.

06:33.030 --> 06:36.440
Now if you transform two here into a string

06:39.630 --> 06:45.080
you can see that all elements are transformed into a string all right.

06:45.090 --> 06:50.880
So this is it for the time being and yeah we learned actually that an impact array contains only one

06:50.880 --> 06:55.050
data type and that's now one of the major differences to a list.

06:55.110 --> 06:58.250
And then the next lesson we learn about bacteria's operations.

06:58.260 --> 07:00.870
This is another main difference to a list.

07:00.870 --> 07:02.640
So we hope to see in the next lesson by.
